package com.learn.atomic;

import org.apache.log4j.Logger;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;

/**
 * @author ln
 * @Description: ${todo}
 * @date 2020/12/21
 */
public class TestDateTimeFormatter {
    private static final Logger log=Logger.getLogger(TestDateTimeFormatter.class);

    public static void main(String[] args) {
        DateTimeFormatter stf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        for (int i = 0; i <10 ; i++) {
            new Thread(()->{
                TemporalAccessor parse = stf.parse("2020-12-21");
                log.debug(parse);
            }).start();
        }
    }


    private static void test(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        for (int i = 0; i < 10 ; i++) {
            new Thread(()->{
                synchronized (sdf){
                    try {
                        log.debug(sdf.parse("2020-12-21"));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                }
            }).start();

        }
    }
}


